﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace DelegateDemo2
{
    public delegate bool SortComparer(object a, object b);

    public static class MySorter
    {
        public static void Sort(object[] array,SortComparer cmp)
        {
            for (int i = 0; i < array.Length; i++)
            {
                for (int j = i + 1; j < array.Length; j++)
                {
                    if (cmp(array[i], array[j]))
                    {
                        object tmp = array[i];
                        array[i] = array[j];
                        array[j] = tmp;
                    }
                }
            }
        }
    }
}
